import java.util.Arrays;

/**
 * @author LKQ
 * @date 2022/2/15 11:06
 * @description
 */
public class Solution {
    public static void main(String[] args) {
        Solution solution = new Solution();
        int[] nums = {2, 1, 3, 4};
        System.out.println(solution.check(nums));
    }
    public boolean check(int[] nums) {
        int n = nums.length;
        int[] copyNums = Arrays.copyOf(nums, n);
        Arrays.sort(copyNums);
        for (int i = 0; i < n; i++) {
            // 0-n-1次轮转，若都不相等，则返回false
            int[] temp = new int[n];
            for (int j = 0; j < n; j++) {
                temp[(j + i) % n] = copyNums[j];
            }
            if (Arrays.equals(nums, temp)) {
                return true;
            }
        }
        return false;
    }
}
